package cvc.framework.controller;

import cvc.framework.entity.Camera;
import cvc.framework.result.RestMessage;
import cvc.framework.result.RestResult;
import cvc.framework.service.FunctionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/Switch")
public class FunctoinSwController {

    @Autowired
    private FunctionService functionService;


    //功能开关
    @RequestMapping("/allSwitch")
    @ResponseBody
    public RestResult allSwitch(String cameraId) {
        RestResult res = new RestResult();
        res.message = new RestMessage();
        res.message.data = functionService.allSwitch(cameraId);
        return res;
    }


    //直播推流
    @RequestMapping("/rtmpLive")
    @ResponseBody
    public RestResult rtmpLive(String cameraId, Boolean checked) {
        RestResult res = new RestResult();
        res.message = new RestMessage();
        res.message.data = functionService.rtmpLive(cameraId, checked);
        return res;
    }

    //激光点云
    @RequestMapping("/laserSwitch")
    @ResponseBody
    public RestResult laserSwitch(String cameraId, Boolean checked) {
        RestResult res = new RestResult();
        res.message = new RestMessage();
        res.message.data = functionService.laserSwitch(cameraId, checked);
        return res;
    }

    //图像识别
    @RequestMapping("/recognitionSwitch")
    @ResponseBody
    public RestResult recognitionSwitch(String cameraId, Boolean checked) {
        RestResult res = new RestResult();
        res.message = new RestMessage();
        res.message.data = functionService.recognitionSwitch(cameraId, checked);
        return res;
    }

}
